package com.hdy.demo.ajax.action;

import java.util.HashMap;
import java.util.Map;

import com.hdy.demo.ajax.dto.AjaxGradeDto;
import com.hdy.demo.ajax.dto.AjaxUserDto;
import com.hdy.framework.struts2.action.BaseAction;

/*http://127.0.0.1/ssh/demo/ajax.action
	by 何栋宇
	2013-1-25
 */
public class MyAjaxAction extends BaseAction{
	private static final long serialVersionUID = -619115918784503394L;

	//ajax接口
	@Override
	public String execute() {
		return SUCCESS;
	}
	//ajax接口
	public String ajaxGet() {
		AjaxGradeDto grade = new AjaxGradeDto();
		grade.setId(1L);
		grade.setGradeName("白金等级");
		AjaxUserDto ajax = new AjaxUserDto();
		ajax.setGrade(grade);
		ajax.setId(1);
		ajax.setName("何栋宇");
		Map<String,Object> ajaxData = new HashMap<String,Object>();
		ajaxData.put("ajaxData", ajax);
		ajaxData.put("otherAjaxData", ajax);
		this.setAjaxData(ajaxData);//存放多个对象
		return "json";
	}
}
